import http from '@/utils/http'
import type { ApiResponse } from '@/types/api';

// 医生患者列表请求参数接口
export interface PatientListRequest {
    /**
     * 医生id
     */
    doctorId: string;
    /**
     * 名称模糊查询
     */
    name?: string;
    /**
     * 页码
     */
    pageNum?: string;
    /**
     * 每页大小
     */
    pageSize?: string;
    /**
     * ACCEPTED:就诊中，COMPLETED:已结束
     */
    status?: string;
    [property: string]: any;
}

// 患者信息接口
export interface PatientVO {
    /**
     * 患者ID
     */
    id: number;
    /**
     * 患者姓名
     */
    name: string;
    /**
     * 患者电话
     */
    phone: string;
    /**
     * 状态
     */
    status: string;
    /**
     * 接诊时间
     */
    acceptTime: string;
    /**
     * 完成时间
     */
    completedTime: string;
    [property: string]: any;
}

// 分页响应接口
export interface PatientListResponse {
    records: PatientVO[];
    total: number;
    [property: string]: any;
}

// 获取医生患者列表
export const getDoctorPatientList = (params: PatientListRequest): Promise<ApiResponse<PatientListResponse>> => {
    return http({
        url: '/doctor/appointment/patient/list',
        method: 'GET',
        params
    })
}

export interface DeletePatientRequest {
    patientIds: number[];
    [property: string]: any;
}

export const deleteDoctorPatient = (params: DeletePatientRequest): Promise<ApiResponse<any>> => {
    return http({
        url: `/doctor/appointment/patient?patientIds=${params.patientIds.join(',')}`,
        method: 'DELETE'
    });
}
